import 'package:fate_blind_box/model/member_list_entity.dart';
import 'package:fate_blind_box/network/Api.dart';
import 'package:get/get.dart';
import '../../network/http_config.dart';
import 'state.dart';

class MemberListLogic extends GetxController {
  final MemberListState state = MemberListState();

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    if(Get.arguments!=null){
      state.matchmakerId = Get.arguments;
    }
  }

  onRefresh()async{
    state.memberList.clear();
    MemberListEntity model = await Api.getInstance().getMemberList(matchmakerId:state.matchmakerId);
    if(model.data != null&& model.data!.isNotEmpty){
        state.memberList.addAll(model.data??[]);
    }
    state.refreshController.refreshCompleted();
    state.memberList.refresh();
  }
}
